package com.hnust.demo.service.imp;

import com.hnust.demo.entity.user;
import com.hnust.demo.respository.userRespository;
import com.hnust.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class userServiceImp implements UserService {

    @Autowired
    private userRespository userRespository;

    @Override
    public List<user> getUserList() {
        return userRespository.findAll();
    }

    @Override
    public user findUserById(long id) {
        return userRespository.findById(id);
    }

    @Override
    public void save(user user) {
        userRespository.save(user);
    }

    @Override
    public void edit(user user) {
        userRespository.save(user);
    }

    @Override
    public void delete(long id) {
        userRespository.deleteById(id);
    }
}
